package post_to_in_pkg.recoder;
import post_to_in_pkg.parser.*;
public class Recoder_v2 {

    private Parser parser_pointer;

    public Recoder_v2(){};
    public Recoder_v2(Parser arg_parser){
        parser_pointer=arg_parser;
    }
    public void setParser(Parser p)
    {
        parser_pointer=p;
    }


    public StringBuffer writeInBuffer(){
        StringBuffer strBuffer=new StringBuffer();
        if(parser_pointer!=null){
            strBuffer.ensureCapacity(256);
            strBuffer.append(parser_pointer.getSyntaxTree().generateCodes()[1]);
            format_DeleteWhiteLine(strBuffer);
        }
        return strBuffer;
    }

    public void format_DeleteWhiteLine(StringBuffer strBuffer){
        String tempStr=strBuffer.toString().replaceAll("\n([\r\n\t])*\n","\n");
        strBuffer.replace(0,strBuffer.length(),tempStr);
    }
}
